/**
 * Created by tsy on 2017/5/22.
 */
function submitSearch() {
    $('#default_table').datagrid('load',{
        select_type: $("#select_type").val(),
        remark_start_promisetime:$("#remark_start_promisetime").datebox('getValue'),
        remark_end_promisetime:$("#remark_end_promisetime").datebox('getValue')
    });
}
function format_overdue(value,row,index){
    var day=row.overdue_day;
    var money=row.recover_money;
    var value=0;
    if(day<=30&&day>1){
        value=money*day*3/1000;
    }else if(day>30&&day<=60){
        value=money*30*3/1000+money*(day-30)*4/1000;
    }else if(day>60){
        value=money*30*3/1000+money*30*4/1000+money*(day-60)*5/1000;
    }
    return value.toFixed(2);
}
function type_table(type){
    $('#default_table').datagrid('load',{
        select_type: type
    });
}
function overdueremark_add(){
    var obj=$("#default_table").datagrid('getSelected');
    if(obj==null){
        alert("请选择逾期账单！");
        return;
    }
    var borrow_id=obj.binfo_id;
    var repay_detail_id=obj.repay_detail_id;
    window.parent.addTab('逾期备注新增','../../borrow/borrowoverdue/overdueremark_add?repay_detail_id='+repay_detail_id+"&borrow_id="+borrow_id);
}
function overdueremark_detail(){
    var obj=$("#default_table").datagrid('getSelected');
    if(obj==null){
        alert("请选择逾期账单！");
        return;
    }
    var borrow_id=obj.binfo_id;
    $('#default_table2').datagrid({
        title:"逾期备注详情",
        queryParams:{
            borrow_id: borrow_id
        },
        columns:[[
            {field: 'user_name', title: '操作人员', width: '9%'},
            {field: 'remark_content', title: '备注内容', width: '60%'},
            {field: 'remark_promisetime', title: '约定还款时间', width: '10%'},
            {field: 'update_time', title: '操作时间', width: '10%'},
        ]]
    });
}